﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Domain.NetworkService;
namespace Web.Models
{
    public class SNMPDetailedOutput
    {
        public List<KeyValuePair<string, string>> result = new List<KeyValuePair<string, string>>();
        public SNMPDetailedOutput(string devName, DeviceTestsInfo dti)
        {
            dti.DeviceName = devName;
            makeResult(dti);
        }
        private void makeResult(DeviceTestsInfo dti)
        {
            foreach (var item in dti.testResults)
            {
                if (item as SnmpResult != null)
                {
                    SnmpResult sr = item as SnmpResult;
                    if (sr.Variable == OidNames.System)
                    {
                        SnmpOutput snmpOutput = new SnmpOutput(sr.Data);
                        result.AddRange(snmpOutput.dict);
                    }
                    if (sr.Variable == OidNames.Hostname)
                    {
                        result.Add(new KeyValuePair<string, string>("Имя хоста: ", sr.Data));
                    }
                    if (sr.Variable == OidNames.Model)
                    {
                        result.Add(new KeyValuePair<string, string>("Модель: ", sr.Data));
                    }
                    if (sr.Variable == OidNames.Uptime)
                    {
                        result.Add(new KeyValuePair<string, string>("Время работы: ", sr.Data));
                    }
                    if (sr.Variable == OidNames.Vendor)
                    {
                        result.Add(new KeyValuePair<string, string>("Производитель: ", sr.Data));
                    }
                }
            }
        }
    }
}
